package com.wzdigit.wms.basic.enums.across;


import com.wzdigit.wms.basic.enums.BaseEnum;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * 删改单控制-OMS删改单控制类型参数
 * @author yangdongjie
 * @SchedulingEnum.java
 * @2021年2月3日下午2:11:54
 */
public enum OrderCloseBillTypeEnum implements BaseEnum {

	GDN_TYPE(0, "GDN_TYPE", "OrderCloseBillType"), 	// 发货通知单
	ASN_TYPE(1, "ASN_TYPE", "OrderCloseBillType"),	// 销售退货单
	TRANSFER_TYPE(2, "TRANSFER_TYPE", "OrderCloseBillType");	// 调拨单

	/**
	 * 枚举值
	 */
	public int code;

	/**
	 * 枚举名称
	 */
	public String enumName;

	/**
	 * 枚举实体类属性描述
	 *
	 * @return
	 */
	public String description;

	OrderCloseBillTypeEnum(String enumName, String description) {
		this.enumName = enumName;
		this.description = description;
	}

	OrderCloseBillTypeEnum(int code, String enumName, String description) {
		this.code = code;
		this.enumName = enumName;
		this.description = description;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getEnumName() {
		return enumName;
	}

	public void setEnumName(String enumName) {
		this.enumName = enumName;
	}
	
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public static OrderCloseBillTypeEnum getEnumByCode(int enumCode) {
		OrderCloseBillTypeEnum[] values = OrderCloseBillTypeEnum.values();
		OrderCloseBillTypeEnum samplingEnum = null;

		for (OrderCloseBillTypeEnum value : values) {
			if (value.getCode() == enumCode) {
				samplingEnum = value;
			}
		}
		return samplingEnum;
	}

	public static OrderCloseBillTypeEnum getEnumByName(String enumName) {
		OrderCloseBillTypeEnum[] values = OrderCloseBillTypeEnum.values();
		OrderCloseBillTypeEnum repairEnum = null;

		for (OrderCloseBillTypeEnum value : values) {
			if (Objects.equals(value.getEnumName(), enumName)) {
				repairEnum = value;
			}
		}
		return repairEnum;
	}

	public static Map<Integer, String> getEnumByDescription(String enumDescription) {
		Map<Integer, String> enumMap = new HashMap<Integer, String>();

		OrderCloseBillTypeEnum[] values = OrderCloseBillTypeEnum.values();
		for (OrderCloseBillTypeEnum value : values) {
			if (Objects.equals(value.getDescription(), enumDescription)) {
				enumMap.put(value.getCode(), value.getEnumName());
			}
		}
		return enumMap;
	}
}
